package com.lzx.lizhenxing.common.config;


import com.lzx.lizhenxing.common.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        // 全部拦截，根据注解辨别哪些请求不需要拦截
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**");
        // 放行的路径
        // .excludePathPatterns("/app/user/login", "/app/user/register");

        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
